#-*- coding: utf-8 -*-
import os
import os.path
import sys
import glob


class find_files():
	def find_all_files(self, rootdir):
		for parent,dirnames,filenames in os.walk(rootdir):  
			#for dirname in  dirnames:                       
				#print "parent is:" + parent
				#print  "dirname is" + dirname

			for filename in filenames:
				#print "parent is:" + parent
				#print "filename is:" + filename
				#print "the full name of the file is:" + os.path.join(parent,filename) 
				print os.path.join(parent,filename) 
	def find_typed_files(self, ext = None):
		for parent,dirnames,filenames in os.walk(rootdir):  
			for filename in filenames:
				filepath = os.path.join(parent,filename) 
				extension = os.path.splitext(filepath)[1][1:]  
				if extension in ext:
					print filepath

if __name__ == "__main__":
	find = find_files()
	rootdir = sys.argv[1]
	#find.find_all_files(rootdir)
	ext = sys.argv[2:]
	find.find_typed_files(ext)
